<template>
  <el-col :span="427" class="inline-flex  items-center" style="padding-left: 65px">
    <el-button type="info" plain  @click="backIndex" v-if="disable">
      <el-icon>
        <Back/>
      </el-icon>
      返回导航页面
    </el-button>
    <el-button type="info" plain @click="logOut">
      <el-icon>
        <SwitchButton/>
      </el-icon>
      退出系统
    </el-button>
  </el-col>
</template>

<script setup>
import {useRouter} from "vue-router";
import {get} from "@/net/axiosMethod.js";
import {ElMessage} from "element-plus";
import {useUserStore} from "@/stores/index.js";
const router = useRouter() //实例化路由
const userStore = useUserStore()
const props = defineProps(['disable'])
const logOut = ()=> {
  get("/api/auth/logout", (message)=> {
    userStore.auth.user = null
    ElMessage({
      message,
      type: 'success',
      duration: 1000
    })
    router.push('/')
  })
}

const backIndex = ()=> {
  router.push('/index')
}
</script>

<style scoped>

</style>